#!/usr/bin/env jython

from javax.swing import JPanel, JFrame, JLabel, BoxLayout, JButton, JTextArea, JTextField, WindowConstants
from java.awt import *
from java.lang import System

def evt_btnAdd( event ):
    print "Not Set"
    pass
pass

def evt_btnClear( event ):
    print "Not Set"
    pass
pass

def evt_btnConvert( event ):
    print "Not Set"
    pass
pass

def evt_btnSearch( event ):
    print "Not Set"
    pass
pass

def evt_btnGenCsv( event ):
    print "Not Set"
    pass
pass

def evt_btnGenHtml( event ):
    print "Not Set"
    pass
pass

def makeConvertPanel():
    panel = JPanel() 
    panel.setLayout( BoxLayout( panel, BoxLayout.Y_AXIS) )   
    
    panel.add( JLabel( "Select a .csv files to be converted in a sqlite database" ) )
    panel.add( JPanel() )
    
    panel.add( JTextArea( 10, 25 ) )
    panel.add( JPanel() )
    
    subPanel = JPanel() 
    subPanel.setLayout( FlowLayout() )
    subPanel.add( JButton( "Add", actionPerformed = evt_btnAdd ) )
    subPanel.add( JPanel() )
    subPanel.add( JButton( "Clear", actionPerformed = evt_btnClear ) ) 
    
    panel.add( subPanel )
    panel.add( JPanel() )
    
    hPanel = JPanel()
    hPanel.setLayout( BoxLayout( hPanel, BoxLayout.X_AXIS ) )
    
    vPanel = JPanel() 
    vPanel.setLayout( BoxLayout( vPanel, BoxLayout.Y_AXIS ) )
    
    subPanel = JPanel() 
    subPanel.setLayout( BoxLayout( subPanel, BoxLayout.X_AXIS ) )
    subPanel.add( JLabel( "Database Name: " ) )
    subPanel.add( JTextField( 15 ) )

    vPanel.add( subPanel )
    
    subPanel = JPanel() 
    subPanel.setLayout( BoxLayout( subPanel, BoxLayout.X_AXIS ) )
    subPanel.add( JLabel( "Table Name: " ) )
    subPanel.add( JTextField( 15 ) )
    vPanel.add( subPanel )
    
    hPanel.add( vPanel )
    hPanel.add( JButton( "Convert", actionPerformed = evt_btnConvert ) )
    
    panel.add( hPanel )
    return panel
    pass
pass

def makeStatisticsPanel():
    
    panel = JPanel() 
    panel.setLayout( BoxLayout( panel, BoxLayout.Y_AXIS) )  
    panel.add( JLabel( "Select a Rebides database to generate statistics" ) )
    panel.add( JPanel() )
    
    subPanel = JPanel() 
    subPanel.setLayout( BoxLayout( subPanel, BoxLayout.X_AXIS ) )
    subPanel.add( JButton( "Search", actionPerformed = evt_btnSearch ) )
    subPanel.add( JTextField( 15 ) )
    panel.add( subPanel )
    
    subPanel = JPanel() 
    subPanel.setLayout( BoxLayout( subPanel, BoxLayout.X_AXIS ) )
    
    
    csvPanel = JPanel() 
    csvPanel.setLayout( BoxLayout( csvPanel, BoxLayout.Y_AXIS ) )  
    
    csvSubPanel = JPanel() 
    csvSubPanel.setLayout( BoxLayout( csvSubPanel, BoxLayout.X_AXIS ) )      
    csvSubPanel.add( JLabel( "CSV Name: " ) )
    csvSubPanel.add( JTextField( 15 ) )
    
    csvPanel.add( csvSubPanel )
    csvPanel.add( JPanel() )
    csvPanel.add( JButton( "Generate .csv files", actionPerformed = evt_btnGenCsv ) )
    
    
    htmlPanel = JPanel() 
    htmlPanel.setLayout( BoxLayout( htmlPanel, BoxLayout.Y_AXIS ) )  
    
    htmlSubPanel = JPanel() 
    htmlSubPanel.setLayout( BoxLayout( htmlSubPanel, BoxLayout.X_AXIS ) )      
    htmlSubPanel.add( JLabel( "HTML Name: ") )
    htmlSubPanel.add( JTextField( 15 ) )
    
    htmlPanel.add( htmlSubPanel )
    htmlPanel.add( JPanel() )
    htmlPanel.add( JButton( "Generate HTML file", actionPerformed = evt_btnGenHtml ) )
    
    
    subPanel.add( csvPanel )
    subPanel.add( JPanel() )
    subPanel.add( htmlPanel )
    
    panel.add( JPanel() )
    panel.add( subPanel )
    return panel
    pass
pass
    
    
    
    
    
    
    
    
    
    
    
    
    
    
       
def showFrame(frame):
    frame.setLayout(FlowLayout())
    frame.setResizable(False)
    frame.pack()
    frame.toFront()
    frame.setVisible(True)
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE)
    pass
pass
    
frame = JFrame( "Jython Application", defaultCloseOperation = JFrame.EXIT_ON_CLOSE)

frame.add( makeConvertPanel() )
frame.add( JPanel() )
frame.add( makeStatisticsPanel() )
showFrame(frame)


















